import { request } from "@/utils/service"
import type * as Combo from "./types/combo"
import { getToken } from "@/utils/cache/cookies"
/** 增 */
export function createComboDataApi(data: Combo.ICreateComboRequestData) {
  return request({
    url: "h5PackageBackup/add",
    method: "post",
    data
  })
}

/** 删 */
export function deleteComboDataApi(id: string) {
  return request({
    url: "h5PackageBackup/del",
    method: "delete",
    params: {
      id
    }
  })
}

/** 改 */
export function updateComboDataApi(data: Combo.ICreateComboRequestData) {
  return request({
    url: "h5PackageBackup/update",
    method: "put",
    data
  })
}

/** 查 */
export function getComboDataApi(params: any) {
  return request<any>({
    url: "h5PackageBackup/query",
    method: "get",
    params
  })
}
/**图片上传 */
export function uploadComboImageList(data: any) {
  return request({
    url: "h5Package/upload",
    method: "post",
    headers: {
      "Content-Type": "multipart/form-data",
      token: getToken()
    },
    data
  })
}

/** 根据套餐/产品id查询详情 */
export function getComboDetail(data: any) {
  return request<any>({
    url: "h5PackageBackup/api/queryId",
    method: "post",
    headers: {
      "Content-Type": "multipart/form-data"
    },
    data
  })
}
/** 上下架 */
export function upOrDwon(data: any) {
  return request({
    url: "h5Package/updateStatus",
    method: "post",
    headers: {
      "Content-Type": "multipart/form-data",
      token: getToken()
    },
    data
  })
}
